<template>
	<view class="page">
		<home-employee ></home-employee>
	<!-- 	<home-boss v-else></home-boss> -->
		<u-toast ref="uToast"></u-toast>
		<u-tabbar  :value="value1" :fixed="true" :placeholder="false"
			:safeAreaInsetBottom="true" activeColor="#F7B530"	>
			<u-tabbar-item text="首页"  @click="homes">
				<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabber/home.png"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabber/home-t.png"></image>
			</u-tabbar-item>
			<u-tabbar-item  text="车市场" @click="photo">
				<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabber/car.png"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabber/car-t.png"></image>
			</u-tabbar-item>
			<u-tabbar-item text="我的"  @click="my">
				<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabber/my.png"></image>
				<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabber/my-t.png"></image>
			</u-tabbar-item>
		</u-tabbar>

	</view>
</template>

<script>
	import HomeBoss from './HomeBoss.vue'
	import HomeEmployee from './HomeEmployee.vue'
	export default {
		data() {
			return {
				value1: 0,
				home: '',
				form: {
					name: '哈哈哈'
				}
			}
		},
		components: {
			HomeEmployee,
			HomeBoss
		},
		onLoad() {

			if (uni.getStorageSync('type') == "") {
				uni.redirectTo({
					url: "/pages/login/login"
				})
			}

			
		},
		onShow() {
			this.home = uni.getStorageSync("type")
			if(this.home!=2){
				setTimeout(() => {
					uni.redirectTo({
						url: "/pages/homeBoss/homeBoss"
					})
				},100)
			}
		},
		methods: {
			homes() {
				uni.redirectTo({
					url: "/pages/home/home"
				})
			},
			my() {
				uni.redirectTo({
					url: "/pages/my/my"
				})
			},
			photo() {
				if (uni.getStorageSync('caruser') == "") {
					this.$refs.uToast.show({
						message: "请先添加车辆",
					})
					return false
				}
				uni.redirectTo({
					url: "/bundle/pages/carsupermarket/carsupermarket"
				})
			},
			change1() {}
		}
	}
</script>

<style lang="scss" scoped>
.u-page__item__slot-icon{
	width: 50rpx;
	height: 50rpx;
}
</style>